package work01;

import java.util.Scanner;

public class work4isEqualNumber {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int count = 0;
        int[] arr = new int[x];
        for (int i = 0; i < x; i++) {
            arr[i] = sc.nextInt();
        }
        for (int i = 0; i < x; i++) {
            for (int j = i + 1; j < x; j++) {
                if(arr[i] == arr[j]){
                    count++;
                    if(count == 4){
                        System.out.println("YES");
                    }
                }
            }
            if(i == x-1 && count < 4){
                System.out.println("NO");
            }
        }
    }
}
